﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
  public  class Luong_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_Luong");
      }
      public DataTable taoBang(string sql)
      {
          return kn.taobang(sql);
      }
      public int update_Luong(Luong_Public maLuong, Luong_Public maCong, Luong_Public thuong, Luong_Public phuCap, Luong_Public tienBaoHiem, Luong_Public giamTruKhac, Luong_Public ngayLap, Luong_Public nguoiLap, Luong_Public ghiChu)
      {
          int n = 9;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaLuong";
          value[0] = maLuong.MaLuong;
          name[1] = "@MaCong";
          value[1] = maCong.MaCong;
          name[2] = "@Thuong";
          value[2] = thuong.Thuong;
          name[3] = "@PhuCap";
          value[3] = phuCap.PhuCap;
          name[4] = "@TienBaoHiem";
          value[4] = tienBaoHiem.TienBaoHiem;
          name[5] = "@GiamTruKhac";
          value[5]=giamTruKhac.GiamTruKhac;
          name[6] = "@NgayLap";
          value[6] = ngayLap.NgayLap;
          name[7] = "@NguoiLap";
          value[7] = nguoiLap.NguoiLap;
          name[8] = "@GhiChu";
          value[8] = ghiChu.GhiChu;
          return kn.update("Update_Luong",name,value,n);
      }
      public int insert_Luong(Luong_Public maCong, Luong_Public thuong, Luong_Public phuCap, Luong_Public tienBaoHiem, Luong_Public giamTruKhac, Luong_Public ngayLap, Luong_Public nguoiLap, Luong_Public ghiChu)
      {
          int n = 8;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaCong";
          value[0] = maCong.MaCong;
          name[1] = "@Thuong";
          value[1] = thuong.Thuong;
          name[2] = "@PhuCap";
          value[2] = phuCap.PhuCap;
          name[3] = "@TienBaoHiem";
          value[3] = tienBaoHiem.TienBaoHiem;
          name[4] = "@GiamTruKhac";
          value[4] = giamTruKhac.GiamTruKhac;
          name[5] = "@NgayLap";
          value[5] = ngayLap.NgayLap;
          name[6] = "@NguoiLap";
          value[6] = nguoiLap.NguoiLap;
          name[7] = "@GhiChu";
          value[7] = ghiChu.GhiChu;
          return kn.update("Insert_Luong", name, value, n);
      }
      public int delete_Luong(Luong_Public maLuong)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaLuong";
          value[0] = maLuong.MaLuong;
          return kn.update("Delete_Luong", name, value, n);
      }
    }
}
